﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Apps/MasterPage.master" AutoEventWireup="false"
    CodeFile="report_stp_auth_staff.aspx.vb" Inherits="Apps_report_stp_auth_staff" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphBody" runat="Server">
    <table width="50%" border="1" align="center" cellpadding="2" cellspacing="2" bordercolor="#999999">
        <tr align="center" bgcolor="#99FFFF">
            <td colspan="2" bgcolor="#FFFFFF" class="th_data">
                ข้อมูลกำหนดสิทธิ์การใช้งานของผู้ใช้งาน
            </td>
        </tr>
        <tr align="left">
            <td width="47%" bordercolor="#CCCCCC" class="td_box">
                หน่วยงาน :
            </td>
            <td width="53%" bordercolor="#CCCCCC" class="td_box">
                <asp:DropDownList ID='ddlDepartment' runat='server' AppendDataBoundItems="True" DataSourceID="ddlStpDepartmentSrc"
                    DataTextField="department_name" DataValueField="department_code" AutoPostBack="True">
                    <asp:ListItem Value="0" Text='หน่วยงาน'></asp:ListItem>
                </asp:DropDownList>
                <asp:ObjectDataSource ID="ddlStpDepartmentSrc" runat="server" SelectMethod="GetStpDepartmentByPrivilege"
                    TypeName="CodeMatrix.Business.GenericData"></asp:ObjectDataSource>
            </td>
        </tr>
         <tr align="left">
            <td width="47%" bordercolor="#CCCCCC" class="td_box">
                กลุ่มผู้ใช้งาน :
            </td>
            <td width="53%" bordercolor="#CCCCCC" class="td_box">
                <asp:DropDownList ID="ddlGroupUser" runat="server" DataSourceID="ddlGroupUserSrc" DataTextField="group_user_name" DataValueField="group_user_code" AutoPostBack="true">
                    <asp:ListItem Value="0">กลุ่มผู้ใช้งาน</asp:ListItem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="ddlGroupUserSrc" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                    SelectCommand="select group_user_code = 0 , group_user_name = 'กลุ่มผู้ใช้งาน'
                                        union all
                                        select group_user_code , group_user_name
                                        from  group_user 
                                        where department_code = @department_code and group_user_status = 1 and group_user_code > 0">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlDepartment" DefaultValue="0" Name="department_code"
                            PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr align="left">
            <td width="47%" bordercolor="#CCCCCC" class="td_box">
                ผู้ใช้งาน :
            </td>
            <td width="53%" bordercolor="#CCCCCC" class="td_box">
                <asp:DropDownList ID="ddlStaff" runat="server" DataSourceID="ddlStaffSrc" DataTextField="staff_name" DataValueField="staff_code">
                    <asp:ListItem Value="0">ผู้ใช้งาน</asp:ListItem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="ddlStaffSrc" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                    SelectCommand="select staff_no = '',staff_code = 0, staff_name = 'ผู้ใช้งาน'
                                        union all
                                        select
                                        staff_no,  
                                        staff_code , 
                                        cast(staff_no as varchar) + ' ' + staff_firstname + ' ' + staff_lastname as staff_name
                                        from  staff
                                        where @group_user_code = group_user_code and staff_status = 1 and staff_code > 0 order by staff_no">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlGroupUser" DefaultValue="0" Name="group_user_code" PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr align="left">
            <td width="47%" bordercolor="#CCCCCC" class="td_box">
                ระบงาน :
            </td>
            <td width="53%" bordercolor="#CCCCCC" class="td_box">
                <asp:DropDownList ID="ddlStpMainSystem" runat="server" DataSourceID="ddlStpMainSystemSrc"
                    DataTextField="main_system_name" DataValueField="main_system_code" AutoPostBack="True"
                    AppendDataBoundItems="True">
                    <asp:ListItem Text="ระบบงาน" Value="0"></asp:ListItem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="ddlStpMainSystemSrc" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                    SelectCommand="
                        select main_system_name , main_system_code 
                        from stp_main_system
                        where main_system_type > 0 and main_system_status = 1">
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr align="left">
            <td width="47%" bordercolor="#CCCCCC" class="td_box">
                เมนูระบบงาน :
            </td>
            <td width="53%" bordercolor="#CCCCCC" class="td_box">
                <asp:DropDownList ID="ddlStpMenuSystem" runat="server" DataSourceID="ddlStpMenuSystemSrc"
                    DataTextField="menu_system_name" DataValueField="menu_system_code">
                    <asp:ListItem Text="เมนูระบบงาน" Value="0"></asp:ListItem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="ddlStpMenuSystemSrc" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                    SelectCommand="
                        select menu_system_code = 0 , menu_system_name = 'เมนูระบบงาน'
                        union all
                        select menu_system_code , menu_system_name 
                        from stp_menu_system
                        where main_system_code  =  @main_system_code
                        and menu_system_status = 1 ">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlStpMainSystem" DefaultValue="0" Name="main_system_code"
                            PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr align="left">
            <td width="47%" bordercolor="#CCCCCC" class="td_box">
                สถานะการใช้งาน :
            </td>
            <td width="53%" bordercolor="#CCCCCC" class="td_box">
                <asp:DropDownList ID='ddlStatus' runat="server">
                    <asp:ListItem Text='สถานะ' Value='0'></asp:ListItem>
                    <asp:ListItem Text='ใช้งาน' Value='1'></asp:ListItem>
                    <asp:ListItem Text='ไม่ใช้งาน' Value='2'></asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr align="center">
            <td colspan="2" bordercolor="#CCCCCC" class="td_data_end">
                <asp:Button ID='btnFilter' Text='แสดงรายงาน' runat='server' />
                <asp:Button ID='btnMainMenu' Text='<%$ Resources:Resource,BTN_MAINMENU %>' runat='server' PostBackUrl="~/Apps/ViewSystem.aspx?Edit=2" />
            </td>
        </tr>
    </table>
</asp:Content>
